<template>
  <header class="header">
				<h1>todos</h1>
				<input class="new-todo" placeholder="What needs to be done?" autofocus @keydown.enter="add" v-model.trim="content">
  </header>
</template>

<script>
export default {
  data(){
    return{
      content:''
    }
  },
  methods:{
    add(){
      if(!this.content){
        return alert('请输入内容')
      }
      this.$emit('addTodo',this.content)
      this.content=''
    }
  }
}
</script>

<style>

</style>